﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace BIN
{
    public class MyWebClient : System.Net.WebClient
    {
        private int timeOut=2000;
        /// <summary>
        /// 时间为毫秒
        /// </summary>
        /// <param name="timeOut"></param>
        public MyWebClient(int miliSeconds)
        {
            this.timeOut = miliSeconds;
        }
        protected override WebRequest GetWebRequest(Uri address)
        {
            HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);
            request.Timeout = timeOut;
            request.ReadWriteTimeout = timeOut;
            return request;
        }
    }
}
